/*
 * @Descripttion: 员工管理
 * @version: V1.0
 */
import { axios } from "../../utils/request";

const api = {
    PageList: "/sys/employee/pageList",
    Save: "/sys/employee/save",
    DELETE: "/sys/employee/delete",
    downloadUrl: "/sys/employee/importTemplate", //下载导入数据模板
    importUrl: "/sys/employee/importEmployee", //导入数据
    exportUrl: "/sys/employee/exportData", //导出数据
    inviteToRegister: "/sys/employee/inviteToRegister" //邀请注册

};


/**
* 获取员工管理列表
*/
export function PageList(parameter) {
    return axios({
        url: api.PageList,
        method: "get",
        params: parameter
    });
}


/**
 * 新增/修改员工管理
 * @param {*} data
 */
export function Save(data) {
    return axios({
        url: api.Save,
        method: "post",
        data: data
    });
}

/**
 * 删除员工管理
 */
export function DeleteById(data) {
    return axios({
        url: api.DELETE,
        method: "delete",
        params: data
    });
}

/**
 * 下载导入数据模板
 */
export function downloadDemo(parameter) {
    return axios({
        url: api.downloadUrl,
        method: "get",
        params: parameter,
        responseType: 'blob'
    });
}

/**
 * 导出数据
 */
export function exportData(parameter) {
    return axios({
        url: api.exportUrl,
        method: "get",
        params: parameter,
        responseType: 'blob'
    });
}

/**
 * 导入数据
 */
export function importData(data) {
    return axios({
        url: api.importUrl,
        method: "post",
        data: data,
        headers: {
            "Content-Type": "multipart/form-data"
        },
        timeout: 5000000,
    });
}

/**
 * 邀请注册
 */
export function inviteToRegister(data) {
  return axios({
    url: api.inviteToRegister,
    method: "post",
    data: data
  });
}